package com.enmonster.myTest;

import com.enmonster.dao.TestUserDao;
import com.enmonster.model.TestUser;
import com.enmonster.session.SqlSession;

import java.util.List;

/**
 * @Author wuxi
 * @create 2019/4/9 下午3:33
 */
public class MyTest {

    public static void main(String[] args) {
        try {
            TestUserDao testUserMapper = SqlSession.getMapper(TestUserDao.class);

            List<TestUser> dataList = testUserMapper.getAll();
            for (TestUser data: dataList) {
                System.out.println("List :"+data.toString());
            }

            List<TestUser> selectData = testUserMapper.select("wuxi",27);
            for (TestUser data: selectData) {
                System.out.println("select  :"+data.toString());
            }

            TestUser data = testUserMapper.getAccountByUserName("nginx");
            System.out.println ("testUser  : "+data.toString ());

            TestUser testUser = new TestUser();
            testUser.setAge(70);
            testUser.setUserName("java");
            int id = testUserMapper.insertData(testUser);
            System.out.println ("insert ID : "+id);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
